package com.example.freeengine.filetranslate.persistence.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.freeengine.filetranslate.persistence.entity.FileTranslateDownloadFile;
import com.google.common.util.concurrent.ListenableFuture;

import java.util.List;


@Dao
public interface FileTranslateDownloadFileDao {

    @Insert
    ListenableFuture<Long> insert(FileTranslateDownloadFile fileTranslateDownloadFile);

    @Query("select * from file_translate_download_file order by id desc")
    LiveData<List<FileTranslateDownloadFile>> findAll();

    @Query("select * from file_translate_download_file order by id desc")
    ListenableFuture<List<FileTranslateDownloadFile>> findAllBlock();

    @Update
    ListenableFuture<Integer> update(FileTranslateDownloadFile fileTranslateDownloadFile);

    @Delete
    ListenableFuture<Integer> delete(FileTranslateDownloadFile fileTranslateDownloadFile);

    @Query("select * from file_translate_download_file where id = :id")
    ListenableFuture<FileTranslateDownloadFile> findById(Long id);
}
